﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HttpClient
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Testing...");
            string url = "http://localhost:1764/PlaceWebService.asmx?wsdl";
            dynamic client = new DynamicHttpClient(url);
            try
            {

                //string da = System.Text.UTF8Encoding.Default.GetString(client.Content);
                //Console.WriteLine(da);
                //foreach (var v in client.DescendantsAndSelf())
                //{
                //    Console.WriteLine(v.ToString());
                //    if (Console.ReadLine().ToString() == "x")
                //        break;
                //}

                Console.WriteLine("Call Web=" + client.HelloWorld());
                Console.WriteLine(client.DownloadString("http://www.google.com"));
            }
            catch (Exception ff)
            {
                Dictionary<ProxyType, Exception> er = client.Errors;
                if (er.Count > 0)
                {
                    foreach (var v in er)
                    {
                        Console.WriteLine("Error --{0} Ex = {1}", v.Key, v.Value);
                    }
                }
            }
            Console.ReadLine();
        }
    }
}
